﻿Imports BUS
Imports DTO
Public Class frmcapnhatloaidocgia

    Private Sub GroupControl1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GroupControl1.Paint

    End Sub

    Private Sub LoadLoaiDocgia()
        dgvDanhSachLoaiDocGia.Rows.Clear()
        Dim bus As New LoaiDocGiaBUS()
        Dim dsLDG As New List(Of LoaiDocGiaDTO)
        dsLDG = bus.LayDSLoaiDocGia()

        For i As Integer = 0 To dsLDG.Count - 1
            dgvDanhSachLoaiDocGia.Rows.Add(dsLDG(i).MaLoaiDocGia, dsLDG(i).TenloaiDocGia)
        Next
    End Sub


    Private Sub frmcapnhatloaidocgia_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadLoaiDocgia()
    End Sub

    Private Sub SimpleButton_CapNhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton_CapNhat.Click
        If dgvDanhSachLoaiDocGia.CurrentRow.Index >= 0 Then
            'MessageBox.Show(dgvDanhSachLoaiDocGia.Item(1, dgvDanhSachLoaiDocGia.CurrentRow.Index).Value)

            Dim frm As New frmxlcapnhatloaidocgia()
            frm.MaLoaiDocGia = dgvDanhSachLoaiDocGia.Item(0, dgvDanhSachLoaiDocGia.CurrentRow.Index).Value
            If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
                LoadLoaiDocgia()
            End If
        Else
            MessageBox.Show("Chưa chọn loại đọc giả !")
        End If

    End Sub
End Class